cmake_minimum_required(VERSION 3.14)
project (MetaDef[CXX])

set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR})

option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)

if (ENABLE_OPEN_SRC)
    if (DEFINED ENV{D_PKG_SERVER})
        set(METADEF_PB_PKG $ENV{D_PKG_SERVER})
    endif()
    set(HI_PYTHON python3)
    include(cmake/external_libs/protobuf_shared.cmake)
    include(cmake/external_libs/protobuf_static.cmake)
    include(cmake/external_libs/protoc.cmake)
    include(cmake/external_libs/securec.cmake)
    include(cmake/external_libs/json.cmake)
    include(cmake/FindModule.cmake)
    include(cmake/intf_pub_linux.cmake)
    include(cmake/external_libs/gtest.cmake)
    include(cmake/external_libs/gbenchmark.cmake)
    include(cmake/test_funcs.cmake)
    if(METADEF_LIB_DIR)
        find_module(slog libalog.so ${METADEF_LIB_DIR})
        find_module(static_mmpa libmmpa.a ${METADEF_LIB_DIR})
        unset(METADEF_LIB_DIR CACHE)
    endif()
endif()

include(cmake/common_funcs.cmake)
add_subdirectory(inc)
add_subdirectory(proto)
add_subdirectory(third_party)
add_subdirectory(graph)
add_subdirectory(exe_graph)
add_subdirectory(error_manager)
add_subdirectory(register)
if (ENABLE_OPEN_SRC)
    add_subdirectory(tests)
endif()
